<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="/common/commonTag.jsp"%>
<html>
	<head>
		<title>树状菜单管理</title>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="${path}/css/backsys/ctx.css">
		<link rel="stylesheet" type="text/css" href="${path}/js/util/confirmer/confir.css"/>
		<script type="text/javascript" src="${path}/js/jquery.js" charset="utf-8"></script>
		<script type="text/javascript" src="${path}/js/util/confirmer/jquery-impromptu.3.1.min.js" charset="utf-8"></script>
		<script type="text/javascript" src="${path}/js/backsys/sysutil.js" charset="utf-8"></script>
		
		<script src="${path}/js/dhtmlx/dhtmlxcommon.js" charset="utf-8"></script>
		
		<link rel="stylesheet" href="${path}/js/dhtmlx/dhtmlxTree/css/style.css" type="text/css" media="screen" />
		<link rel="stylesheet" type="text/css" href="${path}/js/dhtmlx/dhtmlxTree/dhtmlxtree.css">
		<script src="${path}/js/dhtmlx/dhtmlxTree/dhtmlxtree.js" charset="utf-8"></script>	
		
		<link rel="stylesheet" type="text/css" href="${path}/js/dhtmlx/dhtmlxWindows/dhtmlxwindows.css">
		<link rel="stylesheet" type="text/css" href="${path}/js/dhtmlx/dhtmlxWindows/skins/dhtmlxwindows_dhx_skyblue.css">
		<script src="${path}/js/dhtmlx/dhtmlxWindows/dhtmlxwindows.js" charset="utf-8"></script>
		<script src="${path}/js/dhtmlx/dhtmlxWindows/dhtmlxcontainer.js" charset="utf-8"></script>
		
		
	</head>
	<body>
		<div class="ctx" id="winVP">
			<table width="100%" class="blockTable">
				<tr>
					<td>
						<div>
							<span class="zPushBtn"><img src="${path}/images/icon018a1.gif"/><b>资源列表</b></span>
						</div>
					</td>
				</tr>
			</table>	
			
			<table width="100%">
				<tr>
					<td>
						<c:forEach var="s" items="${treex}" varStatus="vs">
							<div style="margin:2px 8px 5px 5px;width:250px; float:left;">
							
								<div id="treeboxbox_tree${vs.count}"  style="width:250px; height:200px;float:left;background-color:#f5f5f5;border :1px solid Silver;overflow:auto;float:left;"></div>
								
								<div style="float:left;width:240px;border-top:0px solid red;height:20px;text-align:right;padding-right:10px;">
									<a href="javascript:void(0);" onClick="tree${vs.count}.setSubChecked(tree${vs.count}.getSelectedItemId(),true);">全选</a> |
									<a href="javascript:void(0);" onClick="tree${vs.count}.setSubChecked(tree${vs.count}.getSelectedItemId(),false);">全不选</a> |
									<a href="javascript:void(0);" onClick="aa(tree${vs.count},tree${vs.count}.getAllChecked());">添加</a> 
								</div>
							</div>
							<script>
								tree${vs.count}=new dhtmlXTreeObject("treeboxbox_tree${vs.count}","100%","100%",0);
					
								tree${vs.count}.setSkin('dhx_skyblue');
								tree${vs.count}.setImagePath("${path}/js/dhtmlx/dhtmlxTree/imgs/csh_bluebooks/");
								tree${vs.count}.enableCheckBoxes(1);
								tree${vs.count}.loadXML("/share/loadTreeXml?num=${vs.count}");
							</script>
						</c:forEach>
						<script type="text/javascript">
							function aa(idObj,id){
								var appUrl = "" ;
								var strs= new Array();
								strs = id.split(",") ;
								
								for(var i=0; i<strs.length; i++) {
									if(idObj.getUserData(strs[i],'uri') != undefined) {
										appUrl += idObj.getItemText(strs[i])+"#"+idObj.getUserData(strs[i],'uri') + "," ;
									}
								}
								if(appUrl!="") {
									doOnLoad(appUrl.substring(0, appUrl.length-1)) ;
								} else {
									alert("请选择数据...") ;
								}
								
							}

							var dhxWins,w1;
							function doOnLoad(data) {
								var l = $(document).scrollLeft(); 
								var t = $(document).scrollTop() ;
							    dhxWins = new dhtmlXWindows();
							    dhxWins.enableAutoViewport(false);
							    dhxWins.attachViewportTo("winVP");
							    dhxWins.setImagePath("${path}/js/dhtmlx/dhtmlxWindows/imgs/");
							    w1 = dhxWins.createWindow("w1", l+180,t+100 , 320, 240);
							    w1.setText("dhtmlxWindow");
							    w1.button("close").enable();
							    attachURL(data) ;
							}
							function attachURL(data) {
								
							    w1.setText("添加保护资源");
							    w1.attachURL("/share/privilegeRes!addBeforeQueryResItem.action?baseform.type=addBeforeSel&baseform.param="+encodeURIComponent(data)+"&d="+new Date().getTime());
							}
						</script>
					</td>
				</tr>
				
			</table>	
		</div>
	</body>
</html>
							
							
							
